package com.lhj.es.web;

import com.lhj.es.service.JDService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author linghaijin
 * @date 2020-05-06 17:32
 */
@RestController
public class JDController {

    @Autowired
    private JDService jdService;

    @RequestMapping("/parse/{keyword}")
    public Boolean parseContent(@PathVariable("keyword") String keyword) throws Exception {
        System.out.println(keyword);
        return jdService.parseContent(keyword);
    }

    @RequestMapping("/search/{keyword}/{pageNo}/{pageSize}")
    public List<Map<String,Object>> keywordSearch(@PathVariable("keyword") String keyword, @PathVariable int pageNo, @PathVariable int pageSize) throws Exception {
        return jdService.searchPage(keyword,pageNo,pageSize);
    }
}
